import { CallHandler, ExecutionContext } from "@nestjs/common";
import { map, Observable } from "rxjs";

export class ResponseInterceptor {
  intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
    return next.handle().pipe(
      map((data) => {
        return {
          code: 200,
          data,
          message: 'success',
        };
      }),
    );
  }
}